#ifndef MD5_H
#define MD5_H

#include <stdio.h>
//#include <limits.h>

typedef  unsigned int  md5_uint32;
typedef  unsigned int*  md5_uintptr;

struct md5_ctx
{
    md5_uint32 A;
    md5_uint32 B;
    md5_uint32 C;
    md5_uint32 D;

    md5_uint32 total[2];
    md5_uint32 buflen;
    char buffer[128];
};;

int sumFile ( FILE *stream, char* md5str  );
int sumBuf (  const char* buf, char* md5str );

void* md5_buffer ( const char *buffer, size_t len, void *resblock );

class MD5
{
        public:
        //MD5();
        //QFile
        static int computerFileMD5(  const char* path, char* md5sum );
        //static QString computerMD5( QString path );
        //QString
        static int computerStrMD5( const char* str, char* md5sum );
        //
        static void demo1();
        static void demo2();
};

void md5_init_ctx ( struct md5_ctx *ctx );
void md5_process_block (	const void *buffer, size_t len, struct md5_ctx *ctx );
void md5_process_bytes ( const void *buffer, size_t len, struct md5_ctx *ctx );
void* md5_finish_ctx ( struct md5_ctx *ctx, void *resbuf );

#endif // MD5_H
